@import "./variables.scss";

// reset
* {
  box-sizing: border-box;
  outline: none;
}

html {
  font-size: 13px;
}

body {
  margin: 0;
  font-family: Arial, Helvetica, sans-serif;
  line-height: 1.2rem;
  background: #f1f1f1;
  --webkit-font-smoothing: antialiased;
}

a {
  color: #999999;
}

p {
  line-height: 1.5rem;
}

@each $colorKey, $color in $colors {
  .text-#{$colorKey} {
    color: $color;
  }

  .bg-#{$colorKey} {
    background: $color;
  }
}

// text-align
@each $var in (left, center, right) {
  .text-#{$var} {
    text-align: $var !important;
  }
}

@each $sizeKey, $size in $font-sizes {
  .fs-#{$sizeKey} {
    font-size: $size * $base-font-size;
  }
}

// width, height
.w-100 {
  width: 100%;
}

.h-100 {
  height: 100%;
}

// flex
.d-flex {
  display: flex;
}

.flex-column {
  flex-direction: column;
}

.flex-1 {
  flex: 1;
}

.flex-grow-1 {
  flex-grow: 1;
}

.flex-wrap {
  flex-wrap: wrap;
}

@each $key, $value in $flex-jc {
  .jc-#{$key} {
    justify-content: $value;
  }
}

@each $key, $value in $flex-ai {
  .ai-#{$key} {
    align-items: $value;
  }
}

@each $typeKey, $type in $spacing-types {
  @each $sizeKey, $size in $spacing-sizes {
    // m-1 => margin: 0.25rem;
    .#{$typeKey}-#{$sizeKey} {
      #{$type}: $size * $spacing-base-size;
    }
  }

  @each $sizeKey, $size in $spacing-sizes {
    // mx-1 => margin-left: 0.25rem; margin-right: 0.25rem;
    .#{$typeKey}x-#{$sizeKey} {
      #{$type}-left: $size * $spacing-base-size;
      #{$type}-right: $size * $spacing-base-size;
    }
    .#{$typeKey}y-#{$sizeKey} {
      #{$type}-top: $size * $spacing-base-size;
      #{$type}-bottom: $size * $spacing-base-size;
    }
  }

  @each $directionKey, $direction in $spacing-direction {
    @each $sizeKey, $size in $spacing-sizes {
      // mt-1 => margin-top: 0.25rem;
      .#{$typeKey}#{$directionKey}-#{$sizeKey} {
        #{$type}-#{$direction}: $size * $spacing-base-size;
      }
    }
  }

  //m
  .#{$typeKey} {
    #{$type}: 0;
  }
}

// button
.btn {
  height: 1.85rem;
  border: none;
  border-radius: 0.154rem;
  font-size: map-get($font-sizes, "sm") * $base-font-size;
  padding: 0.1rem 0.6rem;
  text-decoration: none;
  &.btn-lg {
    display: flex;
    justify-content: center;
    align-items: center;
    i {
      color: map-get($map: $colors, $key: "primary");
      font-weight: bold;
      font-size: 1.5rem;
      margin: 0 1rem;
    }
    border: 1px solid map-get($map: $colors, $key: "light-2");
    border-radius: 0.6rem;
    background: map-get($map: $colors, $key: "white-1");
    padding: 1.5rem 1rem;
    font-size: map-get($map: $font-sizes, $key: "lg") * $base-font-size;
    color: map-get($map: $colors, $key: "dark-1");
  }
}

// nav
.nav {
  display: flex;
  .nav-item {
    border-bottom: 3px solid transparent;
    padding-bottom: 0.2rem;
    &.active {
      color: map-get($map: $colors, $key: "primary");
      border-bottom-color: map-get($map: $colors, $key: "primary");
    }
    .nav-link {
      text-decoration: none;
    }
  }
  &.nav-inverse {
    .nav-item {
      color: map-get($map: $colors, $key: "white");
      &.active {
        border-bottom-width: 3.5px;
        border-bottom-color: map-get($map: $colors, $key: "white");
      }
    }
  }
}

// sprite
.sprite {
  background: url("../images/index.png") no-repeat 0 0;
  background-size: 28.8462rem;
  display: inline-block;
  &.sprite-news {
    background: url("../images/index.png") no-repeat 63.546% 15.517%;
    background-size: 375px 455px;
    width: 23px;
    height: 20px;
  }
  &.sprite-arrow {
    background: url("../images/index.png") no-repeat 38.577% 52.076%;
    background-size: 375px 455px;
    width: 10px;
    height: 10px;
  }
}

// text ellipsis
.text-ellipsis {
  display: inline-block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

// borders
@each $dir in (top, right, bottom, left) {
  .border-#{$dir} {
    border-#{$dir}: 1px solid $border-color;
  }
}

@each $row in (9, 8, 7, 6, 5, 4, 3, 2, 1, 0) {
  @each $col in (3, 2, 1, 0) {
    .hero-attr-#{$col}-#{$row} {
      background: url("../images/hero-attrsp.png")
        no-repeat
        (-$attr-base-size * $col)
        (-$attr-base-size * $row);
      background-size: 10rem 11.25rem;
      width: 1rem;
      height: 1rem;
    }
  }
}

.fw-bold {
  font-weight: bold;
}

.video-item {
  &:last-child{
    border-bottom: none;
  }
  .video-mask {
    display: block;
    position: absolute;
    top: 25%;
    left: 37.5%;
    width: 100%;
    height: 100%;
    background: url(https://game.gtimg.cn/images/yxzj/m/m201706/images/herodetail/video-img.png)
      no-repeat;
    background-size: 2.5rem 2.5rem;
  }
  .video-views {
    background: url("../images/index.png") no-repeat 32.369% 52.578%;
    background-size: 375px 455px;
    width: 12px;
    height: 9px;
  }
}
